package com.jservice.api.smkAppUser;

import com.jservice.framework.dto.Pageable;
import com.jservice.framework.dto.Pager;
import com.jservice.framework.idWorker.Sequence;
import com.jservice.framework.spring.SpringContextUtil;
import com.jservice.model.SmkAppUser;
import com.jservice.web.base.JBaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * SmkNewsQuery
 *
 * @author AutoGenerated
 */
@Service("smkAppUserQuery")
@Transactional(readOnly = true)
public class SmkAppUserService extends JBaseService{

    public static final SmkAppUser DAO = new SmkAppUser();

    public static SmkAppUserService me() {
        return SpringContextUtil.getBean("smkAppUserQuery");
    }

    @Resource
    private Sequence idWorker;

    public Pager findPage(Pageable pageable) {
        return findPage(pageable,DAO, SmkAppUser.TABLE_NAME);
    }

    @Transactional
    public SmkAppUser save(String idcard, String name,String phone) {
        SmkAppUser smkAppUser = new SmkAppUser();
        smkAppUser.setId(idWorker.nextIdStr());
        smkAppUser.setName(name);
        smkAppUser.setIdCard(idcard);
        smkAppUser.setPhone(phone);
        if(smkAppUser.save()){
            return smkAppUser;
        }
        return null;
    }




}
